package com.china.produce.config.rabbitmq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2023/1/1
 */
@Configuration
public class FanoutConfig {

    @Bean
    public FanoutExchange fanoutExchange() {
        return new FanoutExchange("fanout_exchange", true, false);
    }

    @Bean
    public Queue confirmQueue() {

        return new Queue("confirm_queue", true, false, false);
    }

    @Bean
    public Binding bindConfirmQueue() {

        return BindingBuilder.bind(confirmQueue()).to(fanoutExchange());
    }
}
